package com.example.pinkcat.activity.changuserinfo;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.example.pinkcat.R;
import com.example.pinkcat.activity.api.getData.GetData;
import com.example.pinkcat.activity.pinkCatUser.userStaticMsg;

import java.util.Objects;

public class reportActivity extends AppCompatActivity {
    Context context=this;
    EditText editTextreport;
    String comment_id;
    String comment_message;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Objects.requireNonNull(getSupportActionBar()).hide();//去掉标题栏
        setContentView(R.layout.activity_report);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN| View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        }//深色信息栏
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);//允许此线程内发起网络请求

        Intent intent=getIntent();
        comment_id=intent.getStringExtra("comment_id");
        comment_message=intent.getStringExtra("comment_message");



        editTextreport=findViewById(R.id.inputtxt);


        //返回键监听
        findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });

        //确认修改键监听
        findViewById(R.id.change_enter).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (editTextreport.getText().toString().length()<1){
                    Toast.makeText(context,"请输入举报理由",Toast.LENGTH_SHORT).show();
                }else {
                    if (GetData.reportpl(context,comment_id,comment_message,editTextreport.getText().toString()))
                        onBackPressed();
                }
            }
        });
    }
}